#include<Python.h>
#include"node.c"

/*
Ten plik opakowuje node.c tak, zeby mozna bylo z niego korzystac w pythonie
*/


static PyObject* extern_serialize(PyObject* self, PyObject* args)
{
    char* word;

    if (!PyArg_ParseTuple(args, "s", &word))
        return NULL;   
   serialize(word);
   return Py_BuildValue("i",  0 ) ;
}


static PyObject* extern_getVal(PyObject* self, PyObject* args)
{
    char* word;
    if (!PyArg_ParseTuple(args, "s", &word))
        return NULL;
    
   return Py_BuildValue("i",  getVal(word) ) ; 
}

static PyObject* extern_setVal(PyObject* self, PyObject* args)
{
    char* word;
    int val;

    if (!PyArg_ParseTuple(args, "s", &word,&val))
        return NULL;   
   return Py_BuildValue("i",  setVal(word)) ;
}


static PyMethodDef HelloMethods[] =
{
     {"getVal", extern_getVal, METH_VARARGS, "Greet somebody."},
     {"setVal", extern_setVal, METH_VARARGS, "Greet somebody."},
     {"node_serialize", extern_serialize, METH_VARARGS, "Greet somebody."},
     {NULL, NULL, 0, NULL}
};

PyMODINIT_FUNC initnode(void)
{
     (void) Py_InitModule("node", HelloMethods);
}
